/*
package cn.bdqn.pn.config;

import cn.bdqn.pn.realm.UserRealm;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.LinkedHashMap;
import java.util.Map;

@Configuration
public class ShiroConfig {
    */
/**
     * 注入UserReaml
     * @return
     *//*

    @Bean
    public UserRealm getuserRealm(){
        return new UserRealm();
    }

    */
/**
     * 创建过滤器
     * @param securityManager
     * @return
     *//*

    @Bean
    public ShiroFilterFactoryBean getShiroFilerFactoryBean(DefaultWebSecurityManager securityManager){
        //创建ShiroFilterFactoryBean对象
        ShiroFilterFactoryBean shiroFilterFactoryBean=new ShiroFilterFactoryBean();
        //设置安全会话管理
        shiroFilterFactoryBean.setSecurityManager(securityManager);
        //创建map集合，保存各种需要处理的请求
        Map<String,String> filterChainDefinitionMap = new LinkedHashMap<String,String>();

        //设置放行请求，anon请求
        //filterChainDefinitionMap.put("/users/tologin","anon"); //去登录页面的请求
        //filterChainDefinitionMap.put("/users/login","anon");//登录请求
        //filterChainDefinitionMap.put("/index.html","anon");//去到首页

        //设置身份验证请求，authc请求
        //filterChainDefinitionMap.put("/users/add","authc");//添加操作
        //filterChainDefinitionMap.put("/users/update","authc");//修改操作

        //设置角色验证
        //filterChainDefinitionMap.put("/users/add","roles[admin]");
        //filterChainDefinitionMap.put("/users/update","roles[teacher]");
        //多个角色或权限，使用逗号隔开,是或者关系
        //filterChainDefinitionMap.put("/users/update","roles[teacher],roles[admin]");


        //filterChainDefinitionMap.put("/users/update","perms[user:update]");


        //filterChainDefinitionMap.put("/**","authc");//所有请求，放在最后
        //设置过滤器链
        //shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
        //设置登录页面请求(不设置默认进入login.jsp页面)
         //shiroFilterFactoryBean.setLoginUrl("/users/tologin");
         //权限不足，返回的页面
        //shiroFilterFactoryBean.setUnauthorizedUrl("/users/noAuthc");
        //返回ShiroFilterFactoryBean
        return shiroFilterFactoryBean;
    }

    */
/**
     * 关联realm
     * @param realm
     * @return
     *//*

    @Bean
    public DefaultWebSecurityManager getDefaultWebSecurityManager(UserRealm realm){ //UserReaml不是定死的，和自定义的realm的名字必须一样
        //创建DefaultWebSecurityManager对象
        DefaultWebSecurityManager defaultWebSecurityManager=new DefaultWebSecurityManager();
        //关联reaml
         defaultWebSecurityManager.setRealm(realm);
        //返回DefaultWebSecurityManager
        return defaultWebSecurityManager;
    }
}
*/
